mui.init(); 
mui.plusReady(initSomething);
function initSomething(){
		$("#tel_li").on("tap",function(){
			plus.nativeUI.confirm("您确定要拨打电话吗？",
		        function(event){
		            if(event.index ==1){
		                plus.device.dial( "15878878758", false );
		            }else{
		                return false;
		            }
		        }
		        ,'客服消息',['取消','确定']
		    )
		});
		$("#email").parents("li").on("tap",function(){
			var myreg = /^([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/;
			if(!myreg.test("485787596@qq.com")){
				alert("邮箱格式不正确");
			}else{
				location.href = 'mailto:485787596@qq.com';
			}
			 
		})
		
		var view = plus.webview.getWebviewById("contactInfo.html");
		if(view.uid){
			initData(view.uid);
		}
}



function initData(id){
    mui.ajax(ctx+"mobile/user/getOneUser?id="+id,{
		dataType:'json',//服务器返回json格式数据
		type:'post',//HTTP请求类型
		timeout:10000,//超时时间设置为10秒；	              
		success:function(data){
	       	if(data&&data.success){
	       		insertHtml(data.data);
	      	}else{
	      		alert('服务器异常链接失败!');
	      	}
	       	$("#loading").hide();
		},
		error:function(xhr,type,errorThrown){
			alert('服务器异常链接失败!');
		}
	});
}

function insertHtml(data){
	var sex = data.sex;
	txlid = data.ID;
	if("0" == sex){
		$("#photo").attr("src","../../img/common/woman.png");
		$("#sex").attr("src","../../img/common/girl0.png")
	}
	$("#name").html(data.name);
	$("#email").html(data.email);
	$("#tel").html(data.mobile);
	$("#qq").html(data.qq);
	if(data.tel && data.tel !=""){
		$("#tel_li").on("tap",function(){
			plus.nativeUI.confirm("您确定要拨打电话吗？",
		        function(event){
		            if(event.index ==1){
		                plus.device.dial( data.tel, false );
		            }else{
		                return false;
		            }
		        }
		        ,'客服消息',['取消','确定']
		    )
		});
	}
	
	if(data.email && data.emil != ""){		
		$("#email").parents("li").on("tap",function(){
			var myreg = /^([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/;
			if(!myreg.test(data.email)){
				alert("邮箱格式不正确");
			}else{
				location.href = 'mailto:'+data.email;
			}
			 
		})

	}
}

